
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>脚本面板 · Shadow Editor文档</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="PropertyPanel.html" />
    
    
    <link rel="prev" href="Hierachy.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                        <b>1.1.</b>
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="UI.html">
            
                <a href="UI.html">
            
                    
                        <b>1.2.</b>
                    
                    用户界面
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="MenuBar.html">
            
                <a href="MenuBar.html">
            
                    
                        <b>1.2.1.</b>
                    
                    菜单栏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="Toolbar.html">
            
                <a href="Toolbar.html">
            
                    
                        <b>1.2.2.</b>
                    
                    工具栏
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="Scene.html">
            
                <a href="Scene.html">
            
                    
                        <b>1.2.3.</b>
                    
                    场景编辑区
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="Hierachy.html">
            
                <a href="Hierachy.html">
            
                    
                        <b>1.2.4.</b>
                    
                    场景层次图
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.5" data-path="ScriptPanel.html">
            
                <a href="ScriptPanel.html">
            
                    
                        <b>1.2.5.</b>
                    
                    脚本面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="PropertyPanel.html">
            
                <a href="PropertyPanel.html">
            
                    
                        <b>1.2.6.</b>
                    
                    属性面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="SettingPanel.html">
            
                <a href="SettingPanel.html">
            
                    
                        <b>1.2.7.</b>
                    
                    设置面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.8" data-path="HistoryPanel.html">
            
                <a href="HistoryPanel.html">
            
                    
                        <b>1.2.8.</b>
                    
                    历史记录面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.9" data-path="TimelinePanel.html">
            
                <a href="TimelinePanel.html">
            
                    
                        <b>1.2.9.</b>
                    
                    时间轴面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.10" data-path="LogPanel.html">
            
                <a href="LogPanel.html">
            
                    
                        <b>1.2.10.</b>
                    
                    日志面板
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.11" data-path="StatusBar.html">
            
                <a href="StatusBar.html">
            
                    
                        <b>1.2.11.</b>
                    
                    状态栏
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" >
            
                <span>
            
                    
                        <b>1.3.</b>
                    
                    脚本
            
                </span>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >脚本面板</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x811A;&#x672C;&#x9762;&#x677F;">&#x811A;&#x672C;&#x9762;&#x677F;</h1>
<p>&#x811A;&#x672C;&#x9762;&#x677F;&#x7528;&#x6765;&#x7BA1;&#x7406;&#x5F53;&#x524D;&#x573A;&#x666F;&#x4E2D;&#x7684;<code>Javascript</code>&#x811A;&#x672C;&#x3002;</p>
<p><img src="image/scriptPanel.png" alt="image"></p>
<h2 id="&#x65B0;&#x5EFA;&#x811A;&#x672C;">&#x65B0;&#x5EFA;&#x811A;&#x672C;</h2>
<p>&#x5355;&#x51FB;&#x65B0;&#x5EFA;&#x811A;&#x672C;&#x6309;&#x94AE;&#xFF0C;&#x5F39;&#x51FA;&#x65B0;&#x5EFA;&#x811A;&#x672C;&#x7A97;&#x53E3;&#x3002;&#x8F93;&#x5165;&#x811A;&#x672C;&#x540D;&#x79F0;&#xFF08;&#x4E2D;&#x82F1;&#x6587;&#x90FD;&#x884C;&#xFF09;&#xFF0C;&#x70B9;&#x786E;&#x5B9A;&#xFF0C;&#x6253;&#x5F00;&#x811A;&#x672C;&#x7F16;&#x8F91;&#x5668;&#x3002;</p>
<p><img src="image/createScript.png" alt="image"></p>
<p>&#x811A;&#x672C;&#x7F16;&#x8F91;&#x5668;&#x4F1A;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x811A;&#x672C;&#x6A21;&#x677F;&#xFF0C;&#x91CC;&#x9762;&#x63D0;&#x4F9B;13&#x4E2A;&#x4E8B;&#x4EF6;&#xFF0C;&#x4F1A;&#x5728;&#x4E0D;&#x540C;&#x60C5;&#x51B5;&#x4E0B;&#x81EA;&#x52A8;&#x8C03;&#x7528;&#xFF1A;&#x573A;&#x666F;&#x6E32;&#x67D3;&#x524D;&#x3001;&#x573A;&#x666F;&#x6E32;&#x67D3;&#x540E;&#x3001;&#x6BCF;&#x5E27;&#x3001;&#x7ED3;&#x675F;&#x3001;&#x5355;&#x51FB;&#x3001;&#x53CC;&#x51FB;&#x3001;&#x952E;&#x76D8;&#x6309;&#x4E0B;&#x3001;&#x952E;&#x76D8;&#x62AC;&#x8D77;&#x3001;&#x9F20;&#x6807;&#x6309;&#x4E0B;&#x3001;&#x9F20;&#x6807;&#x79FB;&#x52A8;&#x3001;&#x9F20;&#x6807;&#x62AC;&#x8D77;&#x3001;&#x9F20;&#x6807;&#x6EDA;&#x8F6E;&#x6EDA;&#x52A8;&#x3001;&#x5C4F;&#x5E55;&#x5927;&#x5C0F;&#x6539;&#x53D8;&#x3002;</p>
<p>&#x811A;&#x672C;&#x7F16;&#x8F91;&#x5668;&#x4E2D;&#xFF0C;&#x9ED8;&#x8BA4;&#x63D0;&#x4F9B;scene&#x3001;camera&#x3001;renderer&#x4E09;&#x4E2A;&#x5168;&#x5C40;&#x53D8;&#x91CF;&#xFF0C;&#x57FA;&#x672C;&#x7528;&#x6CD5;&#x662F;&#x4F7F;&#x7528;<code>scene.getObjectByName(&apos;&#x540D;&#x79F0;&apos;)</code>&#x83B7;&#x53D6;&#x573A;&#x666F;&#x4E2D;&#x7684;&#x7269;&#x4F53;&#xFF0C;&#x7136;&#x540E;&#x53EF;&#x4EE5;&#x5BF9;&#x7269;&#x4F53;&#x5C5E;&#x6027;&#x8FDB;&#x884C;&#x5404;&#x79CD;&#x4FEE;&#x6539;&#x3002;</p>
<p><img src="image/scriptEditor.png" alt="image"></p>
<p>&#x6211;&#x4EEC;&#x7528;&#x4E00;&#x4E2A;&#x6700;&#x7B80;&#x5355;&#x7684;&#x4F8B;&#x5B50;&#x6765;&#x8BF4;&#x660E;&#x7528;&#x6CD5;&#x3002;&#x5047;&#x8BBE;&#x573A;&#x666F;&#x4E2D;&#x6709;&#x4E2A;&#x53EB;&#x201C;&#x6B63;&#x65B9;&#x4F53;&#x201D;&#x7684;&#x7269;&#x4F53;&#xFF0C;&#x521B;&#x5EFA;<code>&#x6B63;&#x65B9;&#x4F53;&#x65CB;&#x8F6C;</code>&#x811A;&#x672C;&#xFF0C;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">var</span> box = scene.getObjectByName(<span class="hljs-string">&apos;&#x6B63;&#x65B9;&#x4F53;&apos;</span>);

<span class="hljs-comment">// &#x7A0B;&#x5E8F;&#x8FD0;&#x884C;&#x8FC7;&#x7A0B;&#x4E2D;&#xFF0C;&#x6BCF;&#x5E27;&#x90FD;&#x8981;&#x6267;&#x884C;</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">update</span>(<span class="hljs-params">clock, deltaTime</span>) </span>{
    box.rotation.x += <span class="hljs-number">0.1</span>;
}
</code></pre>
<p>&#x5173;&#x95ED;&#x811A;&#x672C;&#x7F16;&#x8F91;&#x5668;&#x7A97;&#x53E3;&#xFF0C;&#x4F1A;&#x81EA;&#x52A8;&#x4FDD;&#x5B58;&#x811A;&#x672C;&#x3002;&#x70B9;&#x51FB;&#x542F;&#x52A8;&#x6309;&#x94AE;&#xFF0C;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x6B63;&#x65B9;&#x4F53;&#x65CB;&#x8F6C;&#x8D77;&#x6765;&#x4E86;&#x3002;</p>
<h2 id="&#x7F16;&#x8F91;&#x811A;&#x672C;">&#x7F16;&#x8F91;&#x811A;&#x672C;</h2>
<p>&#x70B9;&#x51FB;&#x7F16;&#x8F91;&#x6309;&#x94AE;&#xFF0C;&#x53EF;&#x4EE5;&#x7F16;&#x8F91;&#x811A;&#x672C;&#x3002;</p>
<h2 id="&#x4FDD;&#x5B58;&#x811A;&#x672C;">&#x4FDD;&#x5B58;&#x811A;&#x672C;</h2>
<p>&#x5173;&#x95ED;&#x811A;&#x672C;&#x7F16;&#x8F91;&#x5668;&#x6309;&#x94AE;&#xFF0C;&#x53EF;&#x4EE5;&#x81EA;&#x52A8;&#x4FDD;&#x5B58;&#x811A;&#x672C;&#x3002;</p>
<h2 id="&#x5220;&#x9664;&#x811A;&#x672C;">&#x5220;&#x9664;&#x811A;&#x672C;</h2>
<p>&#x70B9;&#x51FB;&#x5220;&#x9664;&#xFF0C;&#x53EF;&#x4EE5;&#x5F39;&#x51FA;&#x5220;&#x9664;&#x811A;&#x672C;&#x5BF9;&#x8BDD;&#x6846;&#x3002;&#x70B9;&#x51FB;&#x786E;&#x8BA4;&#xFF0C;&#x53EF;&#x4EE5;&#x5220;&#x9664;&#x811A;&#x672C;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Hierachy.html" class="navigation navigation-prev " aria-label="Previous page: 场景层次图">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="PropertyPanel.html" class="navigation navigation-next " aria-label="Next page: 属性面板">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"脚本面板","level":"1.2.5","depth":2,"next":{"title":"属性面板","level":"1.2.6","depth":2,"path":"ui/PropertyPanel.md","ref":"ui/PropertyPanel.md","articles":[]},"previous":{"title":"场景层次图","level":"1.2.4","depth":2,"path":"ui/Hierachy.md","ref":"ui/Hierachy.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":true},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}},"theme":"default","pdf":{"pageBreaksBefore":"/","headerTemplate":null,"paperSize":"a4","margin":{"right":62,"left":62,"top":36,"bottom":36},"fontSize":12,"fontFamily":"Arial","footerTemplate":null,"chapterMark":"pagebreak","pageNumbers":true},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Shadow Editor文档","gitbook":"*","description":"Shadow Editor开发文档"},"file":{"path":"ui/ScriptPanel.md","mtime":"2018-10-18T12:46:04.205Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-10-18T13:23:58.055Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

